package indi.a709924470.emergencybutton;

import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Message;
import android.widget.ImageView;

/**
 * Created by Walter Ji on 2017/8/31.
 */

public class ImageLoader {
    private ImageView iw;
    private Handler hlr = new Handler(){
        @Override
        public void handleMessage(Message msg){
            super.handleMessage(msg);
            iw.setImageBitmap((Bitmap) msg.obj);
        }
    };
    public void showimage(ImageView iv, final Bitmap url){
        iw = iv;
        new Thread(){
            @Override
            public void run(){
                super.run();
                Bitmap bm = url;
                Message ms = Message.obtain();
                ms.obj = bm;
                hlr.sendMessage(ms);
            }
        }.start();
    }
}
